﻿using System;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Udp.ReceCNT
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var udpCnt = new UdpClient(Constants.UdpPort);
            while (true)
            {
                var data = await udpCnt.ReceiveAsync();
                var task = Task.Run(() =>
                {
                    var msg = Encoding.UTF8.GetString(data.Buffer);
                    Console.WriteLine(msg);
                    Thread.Sleep(3000);
                });
                task.Start();
                
            }
        }
    }
}
